There are a number of mitigating reasons to create a DLL. Among them are:
| · | Performance |
Parts of your code, while functional, might not execute as fast as you would like. Once you've isolated the bottleneck area(s), a machine code DLL is an obvious choice for optimizing just those areas of your application that are running too slowly.
| · | Resources |
Unlike conventional libraries, when a DLL is loaded into memory by the operating system, its Subs and Functions are accessible by all other programs (or DLLs). Only one copy of the DLL needs to be present in memory. This is possible because the library is not linked into any one of the programs permanently. It is present, in memory, making its services available to any program (or other DLL) which may need them.
| · | Code re-use |
You might have a set of procedures that are common to a number of different applications. Instead of having those procedures appear in every application that needs them, it is better to put them in a DLL where they can be accessed by all the applications. This reduces the size of your executables while giving you the flexibility of updating the DLL itself, without having to re-compile every application that uses its services.
| · | Maintenance |
A DLL can be updated and redistributed without having to re-compile any of the applications (or other DLLs) that use its services.
See Also
Creating a Dynamic Link Library